//
//  UIView+LongMessageView.m
//  1gene
//
//  Created by 1jiyin on 16/5/27.
//  Copyright © 2016年 1jiyin. All rights reserved.
//

#import "UIView+LongMessageView.h"
#define tishiTag1 10092
static NSInteger myTime1;

@implementation UIView (LongMessageView)

-(void)showLongMessageWithContent1:(NSString *)str1 AndContent2:(NSString *)str2
{
    UIView *view=[self viewWithTag:tishiTag1];
    if (view==nil) {
        view=[[UIView alloc]init];
        view.bounds=CGRectMake(0, 0, 300, 110);
        view.center=self.center;
        view.backgroundColor=[UIColor grayColor];
        view.tag=tishiTag1;
        view.layer.cornerRadius=5.0;
        view.layer.masksToBounds=YES;
        [self addSubview:view];
        
        UILabel *lab=[[UILabel alloc]initWithFrame:CGRectMake(0, 20, view.frame.size.width, 20)];
        lab.text=str1;
        lab.font=[UIFont systemFontOfSize:15];
        lab.textColor=[UIColor whiteColor];
        lab.textAlignment=NSTextAlignmentCenter;
        [view addSubview:lab];
        
        UILabel *lab2=[[UILabel alloc]initWithFrame:CGRectMake(0, 40, view.frame.size.width, 50)];
        lab2.text=str2;
        lab2.font=[UIFont systemFontOfSize:15];
        lab2.textColor=[UIColor whiteColor];
        lab2.textAlignment=NSTextAlignmentCenter;
        lab2.numberOfLines=0;
        [view addSubview:lab2];
        
        NSTimer *timer;
        timer=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerRun11) userInfo:nil repeats:NO];
    }

}

-(void)timerRun11
{
    if (myTime1>=8) {
        UIView *view=[self viewWithTag:tishiTag1];
        [view removeFromSuperview];
        myTime1=0;
    }else{
        NSTimer *timer;
        timer=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerRun11) userInfo:nil repeats:NO];
    }
    myTime1++;
}


@end
